import request from "@/plugins/request";

/**
 * api
 */
export default {
  /**
   * GET
   * @param {string} url 路由
   * @param {object} data 参数
   * @returns {import('axios').AxiosPromise<any>} 返回
   */
  GET(url, data = {}) {
    return request({
      url,
      method: "GET",
      params: data,
    });
  },

  /**
   * POST
   * @param {string} url 路由
   * @param {object} data 参数
   * @returns {import('axios').AxiosPromise<any>} 返回
   */
  POST(url, data = {}) {
    return request({
      url,
      method: "POST",
      data,
    });
  },

  /**
   * PUT
   * @param {string} url 路由
   * @param {object} data 参数
   * @returns {import('axios').AxiosPromise<any>} 返回
   */
  PUT(url, data = {}) {
    return request({
      url,
      method: "PUT",
      data,
    });
  },

  /**
   * DELETE
   * @param {string} url 路由
   * @param {object} data 参数
   * @returns {import('axios').AxiosPromise<any>} 返回
   */
  DELETE(url, data = {}) {
    return request({
      url,
      method: "DELETE",
      data,
    });
  },
};
